#include "searchserver.h"
#include "searchdatabase.h"
#include <QDebug>

SearchServer::SearchServer() {}

SearchServer::~SearchServer() {}

int SearchServer::init()
{
    return SearchDataBase::getInstance()->initDataBase(m_searchDbPath);
}

void SearchServer::search(QMap<QString, FileInfo> &resultMap, const QString &keyword)
{
    SearchDataBase::getInstance()->searchFromDB(resultMap, keyword);
}

void SearchServer::setSearchDbPath(const QString &path)
{
    m_searchDbPath = path;
}

int SearchServer::createIndex() {
    return SearchDataBase::getInstance()->creatVirtualDBTable();
}